package com.gemme.gemme.view;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.gemme.gemme.R;

public class BrandListHeadView extends RelativeLayout {
    private Context context;
    public BrandListHeadView(Context context) {
        this(context,null);
    }

    public BrandListHeadView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public BrandListHeadView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        initView();
    }

    TextView tv_num;
    ImageView iv_brand_top;
    private void initView() {
        LayoutInflater.from(context).inflate(R.layout.brand_list_head,this);
        initTopView();

        tv_num = findViewById(R.id.tv_num);

        iv_brand_top = findViewById(R.id.iv_brand_top);
    }

    private void initTopView() {
        Topview topview =  findViewById(R.id.topview);
        topview.setContentViewVisible(false);
    }


    public void setTv_num(String num){
        tv_num.setText(num + "");
    }

    public void setBrandLogo(String brandLogo) {
        try {
            if(TextUtils.isEmpty(brandLogo))
                return;
            Glide.with(context).load(brandLogo).into(iv_brand_top);
        }catch (Exception e){

        }
    }
}
